<?php
/**
 * Created by PhpStorm.
 * User: zhj
 * Date: 2019/2/25
 * Time: 14:19
 */
namespace app\common\model;
use think\Db;

class PeopleRegister extends ModelBase{
    protected $table = 'jz_people_register' ;

    public function getDistinctTypeMajor()
    {
        $query = "SELECT DISTINCT CONCAT_WS('--',`register_type`,register_major) FROM `jz_people_register` ";
        return $this->query($query);
    }

    public function getCompanyUrl($field="*",$page=0,$pageSize=10,$group='')
    {
        $query= "select * from jz_people_register group by $group limit ". $page*$pageSize .",$pageSize";
        return $this->query($query);
    }

    public function getRegister($company_url)
    {
        $query = "SELECT id,people_id,register_type,register_major,CONCAT_WS('--',register_type,register_major) as type_major FROM `jz_people_register` where company_url=".$company_url;
        return $this->query($query);
    }

    public function getListData($where=[],$filed="*",$order="id desc",$page=0,$pageSize=1000)
    {
        if(empty($where)){
            $where =1 ;
        }
        $list = $this->where($where)->field($filed)->order($order)->limit($pageSize*$page,$pageSize)->select();
        return $list;
    }
}